package com.lj.back.manage.scaffold.common.annotation.valid;

/**
 * 使用枚举作为限定条件的校验注解
 * @author lv
 * @version 1.0.0
 */

import com.lj.back.manage.scaffold.common.util.EnumValid;
import com.lj.back.manage.scaffold.common.valid.EnumCheckValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = EnumCheckValidator.class)
public @interface EnumCheck {

    String message() default "{enum.code.invalid}";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

    /**
     * 指定枚举类
     * @return
     */
    Class<? extends Enum<? extends EnumValid>> enumClass();
}
